/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hoja4;

import java.util.Scanner;

/**
 *
 * @author Nery Giron, Adrian Martinez, Maria Fernanda Martinez, Darwin Rivas
 */
class StackFactory<E> {
//selecciona la implementacion a utilizar para un stack
//se utiliza el patron Factory
    
    Scanner scanner = new Scanner(System.in);
    public Stack<E> getStack(String entry, String op) {
    // seleccion de la implementacion a utilizar:
        
        if (entry.equals("AL"))
            return new StackArrayList<>(); //regresa ArrayList
        else if(entry.equals("V"))
            return new StackVector<>(); //regresa Vector
        else if(entry.equals("L")){   
            if(op.equals("S")||op.equals("D")||op.equals("C"))
                return new StackList<>(op); //regresa List
            else{
                System.out.println("Opcion invalida. Default SinglyLinkedList");
                return new StackList<>("S");
            }
        }
        else{
            System.out.println("Opcion invalida. Default StackArrayList");
            return new StackArrayList<>();
        }
   }
}